/**
 * 
 */
package export;

import java.text.DecimalFormat;
import java.util.ArrayList;

/**
 * Exports the optimization results to the console.
 * @author Kevin Wagner
 * @version 1.0
 */
public class ConsoleExport {
	
	/**
	 * Exports the given result to the file result.txt.
	 * 
	 * @param result
	 * @param postComma 
	 * @throws Exception 
	 */
	public static void exportResult(ArrayList<double[]> result, int postComma){
			String format = "##0.";
			if(postComma<0){
				postComma=5;
			}
			for (int i = 0; i < postComma; i++) {
				format += "0";
			}
			DecimalFormat df = new DecimalFormat(format);
			System.out.println("Gen\t Best\t Worst\t Mean\t Std");
			for (int i = 0; i < result.size(); i++) {
				System.out.print(i+";");
				for(int j=0;j<result.get(i).length;j++){
					System.out.print(df.format(result.get(i)[j])+";");
				}
				System.out.println();
			}
	}

}
